package org.dizem.groupon.service.impl;

import org.dizem.groupon.dao.CityDAO;
import org.dizem.groupon.model.domain.CityEntity;
import org.dizem.groupon.service.CityService;

import java.util.List;

/**
 * User: dizem@126.com
 * Time: 11-6-24 上午12:29
 */
public class CityServiceImpl implements CityService {
	private CityDAO cityDAO;

	public void setCityDAO(CityDAO cityDAO) {
		this.cityDAO = cityDAO;
	}

	public CityEntity getByChnName(String chnName) {
		return cityDAO.getByChnName(chnName);
	}

	public void save(CityEntity object) {
		cityDAO.save(object);
	}

	public void delete(CityEntity object) {
		cityDAO.delete(object);
	}

	public void update(CityEntity object) {
		CityEntity city = cityDAO.getByChnName(object.getChnName());
		city.setEngName(object.getEngName());
		cityDAO.update(city);
	}

	public CityEntity getById(int id) {
		return cityDAO.getById(id);
	}

	public List<CityEntity> loadAll() {
		return cityDAO.loadAll();
	}

	public List<CityEntity> load(int firstResult, int maxResult) {
		return cityDAO.load(firstResult, maxResult);
	}

	public int getCount() {
		return cityDAO.getCount();
	}

}
